import Vue from 'vue'
import VueRouter from 'vue-router'
import Main from '../views/Main'
import NoFound from '../views/NoFound'
import Home from '../views/Home/index.vue'
import Search from '../views/Search/index.vue'
import product from '../views/product'
import Cart from '../views/Cart'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: Main,
    redirect: '/home',
    children: [
      {
        path: '/home',
        component: Home,
        meta: {
          isShow: true
        }
      },
      {
        path: '/product/:id',
        component: product,
        meta: {
          title: '商品详情'
        }
      },
      {
        path: '/cart',
        component: Cart,
        meta: {
          title: '购物车'

        }
      },
      {
        path: '/search',
        component: Search,
        meta: {
          isShow: false

        }
      },
    ]
  },
  {
    path: '*',
    component: NoFound
  }
]

const router = new VueRouter({
  routes
})

export default router
